<!DOCTYPE html>
<!-- Reader -->
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="css/iconfont.css">
    <link rel="stylesheet" href="css/reader_search_resault(no).css">
    <script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.js"></script>
    <script type="text/javascript">
        function exit(){
            $("#tanchuceng").css("display","none");
        }
        //正则表达式
        function getQueryString(name)
        {
            var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
            var r = window.location.search.substr(1).match(reg);
            if(r!=null)return  unescape(r[2]); return null;
        }
        $(function(){
            var book=getQueryString("bname");
            $.ajax({
                url : "/reader_search",
                type : "post",
                data : {
                    "bname":book
                },
                success : function (data) {
                    console.log(data);
                    var t = "";
                    for (var i = 0; i < data.length; i++) {
                        t += "<tr>" +
                            "<td>" + data[i].bname + "</td>" +
                            "<td>" + data[i].author + "</td>" +
                            "<td>" + data[i].location + "</td>" +
                            "</tr>";
                    }
                    console.log(t);
                    $("#content").html(t);
                    $("#content tr").bind("click", function(){
                        $("#message").html("Please login first!");
                        $("#tanchuceng").css("display","block");
                    })
                }
            });
        });
    </script>
</head>
<body>
    <div class="main">
        <header class="header clearfix">
            <i class="iconfont icon-yun"></i>
            <i>Library</i>
            <a href="/reader_searchbook(no)" class="readerhome">Main</a>
        </header>
        <div class="table">
            <table class="result">
                <thead>
                    <!-- table row -->
                    <tr>
                        <th>Name</th>
                        <th>Author</th>
                        <th>Position</th>
                    </tr>
                </thead>
                <tbody id="content">
                    
                </tbody>
            </table>
        </div>
        <footer class="footer">
            <div class="mandarin">
                <img src="images/mandarin.png" alt="">
            </div>
            <p>Shan ICP number18018134 | Powered by 1713011</p>
        </footer>
    </div>

    <div id="tanchuceng">
        <div id="msg">
            <div id="exit" onclick="exit()">x</div>
            <p id="message"></p>
        </div>
    </div>
</body>
</html>